<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/taglibs.jsp"%>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="${ctx}/resources/semanticui/semantic.min.css"
	rel="stylesheet" type="text/css" />
<link href="${ctx}/resources/apps.css" rel="stylesheet" type="text/css" />
<title>HR信息</title>
</head>
<body>
	<div class="ui segment" id="n-page">
		<c:choose>
			<c:when test="${(employer.binded==1)&&(company.approved > 0) }">
				<a class="ui red right ribbon label">已认证</a>
			</c:when>
			<c:otherwise>
				<a class="ui red right ribbon label">未认证</a>
			</c:otherwise>
		</c:choose>

		&nbsp;<br> &nbsp;<br>
		<h3 class="ui attached header" id="list-title">HR信息</h3>
		&nbsp;<br>
		<c:choose>
			<c:when test="${employer.imgUrl != null }">
<%--				<img  class="ui small centered image"  src="${ctx}/rs/${employer.imgUrl}">--%>
				<div>
					<div style="position: relative;border: 5px solid lightblue;width: 150px;height:150px;margin: 5px auto;border-radius: 50%;">
						<img src="${ctx}/rs/${employer.imgUrl}" alt="选择并上传头像" id="avatar_img"
							 style="width: 140px;height: 140px;left:0;top: 0;border-radius: 50%;"/>
						<input type="file" id="avatar_file" name="avatar_file"
							   accept="image/jpg,image/png,image/gif"
							   style="width: 100%;height:100%;opacity: 0;position: absolute;left:0;top: 0;"/>
					</div>
					<span style="text-align: center; color: #C0C0C0">点击头像进行修改</span>
					<br/>
				</div>
			</c:when>
			<c:otherwise>
<%--				<img  class="ui small centered image"  src="${employer.headImgUrl}">--%>
				<div style="position: relative;border: 5px solid lightblue;width: 150px;height:150px;margin: 5px auto;border-radius: 50%;">
					<img src="${employer.headImgUrl}" alt="选择并上传头像" id="avatar_img"
						 style="width: 140px;height: 140px;left:0;top: 0;border-radius: 50%;"/>
					<input type="file" id="avatar_file" name="avatar_file"
						   accept="image/jpg,image/png,image/gif"
						   style="width: 100%;height:100%;opacity: 0;position: absolute;left:0;top: 0;"/>
					<span style="text-align: center; color: #C0C0C0">点击头像进行修改</span>
				</div>
			</c:otherwise>
		</c:choose>





		&nbsp;<br>&nbsp;<br>&nbsp;<br>
		 姓名：${employer.name}&nbsp;<br>&nbsp;<br>
		 职位：${employer.roleName}&nbsp;<br>&nbsp;<br>
		手机：${employer.phone}&nbsp;<br>&nbsp;<br>
		座机：${employer.telephone}&nbsp;<br>&nbsp;<br> 公司
		邮箱：${employer.email}&nbsp;<br>&nbsp;<br>

		公司名称：${company.name}&nbsp;<br>&nbsp;<br> 细分领域：
		<c:forEach items="${domains}" var="domain">
			<c:choose>
				<c:when test="${company.domain == domain.id }">
                    ${domain.name}
                </c:when>
			</c:choose>
		</c:forEach>
		&nbsp;<br>&nbsp;<br>
		<!--   联系人：${company.contact}&nbsp;<br>&nbsp;<br> -->

		公司地址：${company.address}&nbsp;<br>&nbsp;<br> <input
			type="hidden" name="hrid" id="hrid" value="${employer.id}" /> <input
			type="hidden" name="companyid" id="companyid" value="${company.id}" />
		<div class="ui center aligned segment" id="choice-buttons">
		<div class="fluid ui button" id="next">修改HR信息</div>
		</div>

	</div>
	<!-- 
    <div class="ui segment" id="btn-next">
        <div class="fluid ui button" id="next">修改信息</div>
    </div> -->
    

<%--	<script src="${ctx}/resources/jweixin-1.0.0.js"></script>--%>
	<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
	<script src="${ctx}/resources/semanticui/jquery-2.1.4.min.js"></script>
	<script src="${ctx}/resources/semanticui/semantic.js"
		type="text/javascript"></script>
	<script type="text/javascript">

wx.config({
    debug: false,
    appId: "${config.appid}",  
    timestamp: ${config.currenttimestamp},  
    nonceStr: "${config.nonceStr}", 
    signature: "${config.signatureStr}", 
    jsApiList: ['checkJsApi',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo',
        'showOptionMenu',
			'updateAppMessageShareData',
			'updateTimelineShareData',
        'closeWindow']  
});

        var handler = {
            activate : function() {
                $(this).addClass('active').siblings().removeClass('active');

                if($(this).attr('id') == 'closeit') {
                    wx.closeWindow();
                }

                if ($(this).attr('id') == 'next') {
                    var hrid = $('#hrid').val();
                    var companyid = $('#companyid').val();
                    var getUrl = '${ctx}/wechat/employer/toEdit.page';
                    getUrl += '?hrId=' + hrid;
                    //getUrl += '&companyId=' + companyid;
                    
                    $(this).addClass('disabled');

                    location.href = getUrl;
                }
            }
        };

		// 头像预览
		$("#avatar_file").change(function () {
			debugger;
			// 获取上传文件对象
			var imgs = $(this)[0].files[0];
			var formData = new FormData();//新建一个formData来储存需要传递的信息
			formData.append('file', imgs);//需要传递的字段image路径
			formData.append('type', 'hr');//id
			$.ajax({
				type: 'POST',
				url: '${ctx}/rs/img/upload',
				data: formData,
				contentType:false,
				processData:false,
				dataType: 'json',
				success: function (data) {
					$("#avatar_img").attr("src", data.file);
				},
				error: function (err) {
					alert("修改出错，请稍后再试！");
				}
			});



		});

        $(document).ready(function() {
         	$('.button').on('click', handler.activate);
         	var uri = location.href.split("#")[0];
			// alert(uri);
			wx.ready(function() {
				wx.onMenuShareAppMessage({
					title: 'Headoffer--专业招聘平台----推荐有奖！',
					desc: '搭起企业和专业猎头的桥梁，为企业招募英才。',
					link: uri,
					imgUrl: 'https://headoffer.com/logo_v2.png'
				});

				wx.onMenuShareTimeline({
					title: 'Headoffer--专业招聘平台----推荐有奖！',
					desc: '搭起企业和专业猎头的桥梁，为企业招募英才。',
					link: 'https://www.tiaonali.com${ctx}/wechat/employer/main.page',
					imgUrl: 'https://headoffer.com/logo_v2.png'
				});

				wx.showOptionMenu();
			});
        });


    </script>
</body>
</html>